#include "PrecompiledHeaderRenderer_OpenGL.h"
#include "ClearWrapper.h"

/*--------------------------------------------------------------------------*/
Color ClearWrapper::_clearColor = Color(0.0f, 0.0f, 0.0f, 0.0f);
float ClearWrapper::_clearDepth = 1.0f;
/*--------------------------------------------------------------------------*/

ClearWrapper::ClearWrapper()
{
	glClearColor(_clearColor.r, _clearColor.g, _clearColor.b, _clearColor.a);
	glClearDepth(_clearDepth);
}

/*--------------------------------------------------------------------------*/

ClearWrapper::~ClearWrapper()
{
}

/*--------------------------------------------------------------------------*/

void ClearWrapper::ClearColor(const Color& color)
{
	if (_clearColor != color)
	{
		_clearColor = color;
		glClearColor(_clearColor.r, _clearColor.g, _clearColor.b, _clearColor.a);
	}
}

/*--------------------------------------------------------------------------*/

void ClearWrapper::ClearDepth(float color)
{
	if (_clearDepth != color)
	{
		_clearDepth = color;
		glClearDepth(_clearDepth);
	}
}

/*--------------------------------------------------------------------------*/

void ClearWrapper::ClearColorBuffer()
{
	glClear(GL_COLOR_BUFFER_BIT);
}

/*--------------------------------------------------------------------------*/

void ClearWrapper::ClearDepthBuffer()
{
	glClear(GL_DEPTH_BUFFER_BIT);
}

/*--------------------------------------------------------------------------*/

void ClearWrapper::ClearStencilBuffer()
{
	glClear(GL_STENCIL_BUFFER_BIT);
}

/*--------------------------------------------------------------------------*/

void ClearWrapper::ClearColorAndDepthBuffers()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}

/*--------------------------------------------------------------------------*/

void ClearWrapper::ClearColorAndStencilBuffers()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}

/*--------------------------------------------------------------------------*/

void ClearWrapper::ClearDepthAndStencilBuffers()
{
	glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}

/*--------------------------------------------------------------------------*/

void ClearWrapper::ClearBuffers()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}

/*--------------------------------------------------------------------------*/